import upload from "@/utils/upload";
import request from "@/utils/request";

//  导入
export function uploadFile(data) {
  return upload({
    url: "/system/equipment/importData",
    filePath: data.filePath,
  });
}

// 导出
export function exportFile(data) {
  return request({
    url: "/system/equipment/export",
    method: "post",
    data: data,
  });
}

// 列表
export function getLists(data) {
  return request({
    url: "/system/equipment/list",
    method: "get",
    data: data,
  });
}

// 修改
export function updateEq(data) {
  return request({
    url: "/system/equipment",
    method: "put",
    data: data,
  });
}

// 删除
export function deleteEq(data) {
  return request({
    url: `/system/equipment/${data.id}`,
    method: "delete",
  });
}

// 查看所有平台
export function getPositionList(data) {
  return request({
    url: `/system/equipment/position/list`,
    method: "get",
    data: data,
  });
}

// 根据平台查找所有设备
export function getPositionDetailList(data) {
  return request({
    url: `/system/equipment/list`,
    method: "get",
    data: data,
  });
}

// 我的提醒
export function getLatestList(data) {
  return request({
    url: `/system/equipment/latest`,
    method: "get",
    data: data,
  });
}

// 更新设备信息
export function updateInfo(data) {
  return request({
    url: `/system/equipment`,
    method: "put",
    data: data,
  });
}

// 更新维修记录
export function updateRepair(data) {
  return request({
    url: `/system/equipment/repair/add`,
    method: "post",
    data: data,
  });
}

// 查看历史
export function getHistory(data) {
  return request({
    url: `/system/equipment/history/${data.id}`,
    method: "get",
    data: data,
  });
}

// 维修记录
export function getRepairList(data) {
  return request({
    url: `/system/equipment/repair/${data.id}`,
    method: "get",
    data: data,
  });
}

// 日志记录
export function getLogList(data) {
  return request({
    url: `/monitor/operlog/list`,
    method: "get",
    data: data,
  });
}

//获取类型
export function getPositionType(data) {
  return request({
    url: `/system/equipment/position/type`,
    method: "get",
    data: data,
  });
}


// 1.3 列表 GET /system/equipment/list
// 1.4 修改 PUT  /system/equipment
// 1.5 删除 DELETE /system/equipment/{ids}
// 2.平台管理(查看)
// 2.1 查看所有平台  GET /system/equipment/position/list
// 2.2 根据平台查找所有设备 GET  /system/equipment/list 参数position 值从2.1取
